package com.mm.fam.web.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mm.fam.web.base.ResponseModel;
import com.mm.fam.web.entity.SysUser;
import com.mm.fam.web.vo.OrganizationUser;
import org.springframework.http.ResponseEntity;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author ztgreat
 * @since 2018-09-29
 */
public interface SysUserService extends IService<SysUser> {

    /**
     * 通过关键词搜索分页
     * @param search
     * @return
     */
    IPage<SysUser> queryUserList(Integer pageNum, Integer pageSize, String search, Integer roleId);

    /**
     * 保存用户
     * @param user
     * @return
     */
    String saveUser(SysUser user, Integer roleId) throws  RuntimeException;

    /**
     * 查询系统用户信息
     * @param userId
     * @return
     */
    ResponseEntity<ResponseModel<SysUser>> querySysUserInfo(Integer userId);

    /**
     * 保存机构用户
     * @param ou 机构用户vo
     * @return
     */
    ResponseEntity<ResponseModel<Object>> saveOrUpdateOrganizationUser(OrganizationUser ou);

    /**
     * 查询机构用户
     * @param id 用户id
     * @return
     */
    ResponseEntity<ResponseModel<OrganizationUser>> queryOrganizationUserInfo(Integer id);

    /**
     * 更新 系统用户登录时间
     * @param id
     * @return
     */
    String updateLoginTime(Integer id) throws  RuntimeException;


    String delete(List<Integer> ids) throws  RuntimeException;

    // 保存
    String saveSysUser(SysUser sysUser);

    // 删除
    Integer delUserbyId(Integer userId);

    boolean checkUsername(String username);

    List<SysUser> queryRiskerListSimple();
}
